using Godot;

[GlobalClass]
public partial class CMoveState : CState
{
    public override void run(Node n, double delta)
    {
        if (n is NCharacter cha)
        {
            if (CHelp.doMove(cha, cha.mData.mMoveTarget, delta))
            {
                cha.mData.mState = new CIdleState();
                return;
            }

            cha.mData.mDir = CHelp.checkDir(cha.GlobalPosition, cha.mData.mMoveTarget);
            cha.play(ANI_TYPE.WALK);
        }
    }
}